import http from "@/http/index.ts"
import {
    ElectricalControlClassification,
    ElectricalControlClassificationListParam,
    ElectricalControlMaterial,
    ElectricalControlMaterialListParam
} from '@/api/electrical/type.ts'

// 分类相关API
// ----------------------------------------

// 新增分类
export const addClassificationApi = (data: ElectricalControlClassification) => {
    return http.post("/electrical/createClassification", data)
}

// 分页条件查询分类列表
export const getClassificationListApi = (data: ElectricalControlClassificationListParam) => {
    return http.get("/electrical/getClassificationList", data)
}

// 编辑分类
export const editClassificationApi = (data: ElectricalControlClassification) => {
    return http.put("/electrical/updateClassification", data)
}

// 删除分类
export const deleteClassificationApi = (id: number) => {
    return http.delete(`/electrical/deleteClassification/${id}`)
}

// 获取分类精简列表
export const getSimpleClassificationListApi = () => {
    return http.get("/electrical/simpleClassificationList")
}

// 材料相关API
// ----------------------------------------

// 新增材料
export const addMaterialApi = (data: ElectricalControlMaterial) => {
    return http.post("/electrical/createMaterial", data)
}

// 分页条件查询材料列表
export const getMaterialListApi = (data: ElectricalControlMaterialListParam) => {
    return http.get("/electrical/getMaterialList", data)
}

// 编辑材料
export const editMaterialApi = (data: ElectricalControlMaterial) => {
    return http.put("/electrical/updateMaterial", data)
}

// 删除材料
export const deleteMaterialApi = (id: number) => {
    return http.delete(`/electrical/deleteMaterial/${id}`)
} 